Skip to content

feat: allow Cmd+L / Cmd+I on empty selection to select the entire line #6711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fbricon
Copy link
Contributor

@fbricon fbricon commented Jul 18, 2025

This PR makes it simpler to add code to the Chat context: if no code is selected, the entire line is added to the context by Cmd+I or Cmd+L. This behaviour is similar to what Github Copilot offers.

expand-empty-selection.mp4

Summary by cubic

Cmd+L and Cmd+I now select the entire line if no text is selected, making it easier to add code to the Chat context. This matches the behavior found in GitHub Copilot.

@fbricon fbricon requested a review from a team as a code owner July 18, 2025 17:12
@fbricon fbricon requested review from Patrick-Erichsen and removed request for a team July 18, 2025 17:12
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 18, 2025
@Patrick-Erichsen
Copy link
Collaborator

I think some of the e2e tests have a valid failure here.

But, I believe at least for cmd + i the current behavior is to insert at the cursor location rather than add the line as context. I think this would also break the ability to toggle open/close the sidebar using cmd + L.

Is your main thought here that Copilot behaves in the way you showed in that video?

cc @sestinj for a second opinion on behavior.

@Patrick-Erichsen
Copy link
Collaborator

Chatted this over with @sestinj

  • We'd like to preserve the cmd + L sidebar toggling behavior
  • We'd like to preserve cmd + I insert behavior, but only on empty lines.

With that in mind, could we scope the update to basically be "if the user pressed cmd + I on a line with any characters, the entire line is added to context` ?

@fbricon
Copy link
Contributor Author

fbricon commented Jul 28, 2025

So from what I can see, the existing Cmd+L behavior is to show the webview if hidden, and focus the cursor there. Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

I can look into reducing the scope of Cmd+I, I'll see if it works

@Patrick-Erichsen
Copy link
Collaborator

Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

Hm, this isn't working for you? For me if I repeatedly hit Cmd + L it will open/close the sidebar.

@Patrick-Erichsen
Copy link
Collaborator

I merged main but I believe the remaining failures are legitimate.

@fbricon
Copy link
Contributor Author

fbricon commented Jul 31, 2025

So actually the bulk of these changes concerns selecting the whole line on Cmd+L.

For Cmd+I, the only thing that changed was the command is now visible when right-clicking on the editor (removing the editorHasSelection clause for continue.focusEdit in package.json). The behavior of Cmd+I itself has not changed.

If the new Cmd+L behavior is not something the Continue team is willing to get in, this is fine, we can just reject this PR. But if you find some value in this approach, then I'll look more closely into the test failures, as expectations have changed.

@Patrick-Erichsen Let me know what you decide.

@fbricon
Copy link
Contributor Author

fbricon commented Jul 31, 2025

Not sure it's accurate to call it toggle, since another Cmd+L doesn't hide it, but the webview is unfocused.

Hm, this isn't working for you? For me if I repeatedly hit Cmd + L it will open/close the sidebar.

No it doesn't work for me that way. 2nd Cmd+L doesn't close the sidebar, just unfocusses it. I tried woth both release and prerelease versions of continue, on 2 macbooks.

@Patrick-Erichsen
Copy link
Collaborator

Patrick-Erichsen commented Aug 4, 2025

Hm, well the cmd + L toggle behavior not working is a bug, that is the intended behavior.

But if the cmd + I behavior remains the same and the bulk of the changes are around the cmd + L line highlight then I think we can close this out, unfortunately. I don't think we have metrics on how many people actually use the toggle behavior so it's more of a "gut feel" but at least on the team most of use the toggle behavior quite frequently.

@Patrick-Erichsen
Copy link
Collaborator

@fbricon circling back here, chatted things over more with @TyDunn and I think we'd be opening to aligning with Copilot here, eg having cmd + L add the current line.

I think it's likely that the only folks using the toggle behavior is the internal Continue team.

@fbricon
Copy link
Contributor Author

fbricon commented Aug 15, 2025

ok, I'll take a look at the test failures when I'm back from PTO on Monday

@fbricon fbricon force-pushed the empty-selection-selects-line branch from bf886bd to 96c3627 Compare August 18, 2025 11:31
@Patrick-Erichsen
Copy link
Collaborator

Think a few are still failing unfortunately

@fbricon
Copy link
Contributor Author

fbricon commented Aug 19, 2025

Yes, it was a simple rebase. I need to figure out how to run those tests locally

@fbricon fbricon force-pushed the empty-selection-selects-line branch from 96c3627 to 1696eb2 Compare August 21, 2025 14:22
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 21, 2025
@RomneyDa
Copy link
Collaborator

@fbricon after sitting on this for a while we're thinking it should add the whole file, since in most cases during usage the user will want to just add the file to context, and one line is rarely useful/probably usually confusing to the model. Thoughts on tweaking to add full file instead of that line?

Agree that removing the sidebar toggle functionality is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants